package com.mbyte.easy.util;

/**
 * @ClassNameStringUtil
 * @Description 字符串处理工具类
 * @Author myr
 * @Date 2019/12/16 16:55
 * @Version 1.0
 **/
public class StringUtil {

    /**
     * @Description java 以逗号隔开的String字符串转int数组
     * @param value
     * @Author myr
     * @return
     **/
    public static int[] stringConvertInt(String value) {
        int[] intArr = new int[0];
        if(isNull(value)){
            intArr = new int[0];
        }else{
            String[] valueArr = value.split(",");
            intArr = new int[valueArr.length];
            for (int i = 0; i < valueArr.length; i++) {
                intArr[i] = Integer.parseInt(valueArr[i]);
            }
        }
        return intArr;
    }

    private static boolean isNull(String param){
        if(param==null||param.isEmpty()||param.trim().equals("")) return true;
        return false;
    }

    public static void main(String[] args) {

    }
}
